import java.util.Scanner;

public class 求阶乘之和 {
    public static int factorial(int n ){
        int s,j ;
        int sum=0;
        for (int i = 1; i <= n; i++) {
            j = 1;
            for ( s = 1; j <= i; j++) {
                s = s * j;
            }
            sum+= s;
        }
        return sum;
    }


    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入整数n ");
        int n = sc.nextInt();
        System.out.println("结果为"+factorial(n));
    }
}
